<template>
  <div class="app-container">
    <div class="layout-content">
      <keep-alive v-if="$route.meta.keepAlive">
        <router-view />
      </keep-alive>
      <router-view v-else />
    </div>
    <div class="layout-footer">
      <TabBar :data="tabbars" @change="handleChange" />
    </div>
  </div>
</template>

<script>
import TabBar from '@/components/TabBar'
import NavBar from '@/components/NavBar'
export default {
  name: 'AppLayout',
  data() {
    return {
      companyId: window.localStorage.getItem('companyId'),
      tabbars: [
        {
          title: '首页',
          path: '/index',
          icon: 'work',
          activebg: 'https://testlearn.oss-cn-hangzhou.aliyuncs.com/tab/index_active.png',
          inactivebg: 'https://testlearn.oss-cn-hangzhou.aliyuncs.com/tab/index.png',
          size: 24
        },
        {
          title: '讲师',
          path: '/lecturer',
          icon: 'work',
          activebg: 'https://testlearn.oss-cn-hangzhou.aliyuncs.com/tab/train_active.png',
          inactivebg: 'https://testlearn.oss-cn-hangzhou.aliyuncs.com/tab/train.png',
          size: 24
        },
        {
          title: '我的',
          path: '/mine',
          icon: 'list',
          activebg: 'https://testlearn.oss-cn-hangzhou.aliyuncs.com/tab/mine_active.png',
          inactivebg: 'https://testlearn.oss-cn-hangzhou.aliyuncs.com/tab/mine.png',
          size: 24
        }
      ]
    }
  },
  components: {
    TabBar,
    NavBar
  },
  created() {

  },
  methods: {
    handleChange(v) {
      // console.log('tab value:', v)
    }
  }
}
</script>
<style lang="less">
  .app-container{
    width: 100%;
    height: 100vh;
    padding-bottom: 50px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    .layout-content{
      width: 100%;
      height: 100%;
      overflow-y: auto;
    }
    .layout-footer{
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      height: 50px;

    }
  }
</style>
